package semaphores;

import train.Train;

public class Rouge implements State { 

	private static final Rouge instance = new Rouge();
	
	/**
	 * Private constructor prevents instantiation from other classes
	 */
	private Rouge() {}
	
	/**
	 * 
	 * @return Return the unique instance of this class
	 */
	public final static Rouge getInstance() {
	    return instance;
	}
    
    /**
     * Set the train's speed 
	 *
     * @param unTrain The train which see the semaphore sem
     */
    public void actionOnTrain(Train unTrain) {
   		//As the semaphore is Red, we stop the train
   		unTrain.setCurrentSpeed(0);
    }
    
    public String toString() {
    	return "Je suis un feu rouge";
    }
}
